﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GenUtil.Util;
using System.Net;
using GenUtil;

namespace WebApp.Billing
{
    public partial class Display : System.Web.UI.Page
    {
        private static Logger logger = new Logger(typeof(Display));
        protected void Page_Load(object sender, EventArgs e)
        {
            logger.debug("Entering in Display.Page_Load()");
            //string filepath = Settings.SessionContext.CurrentData.ToString();
            //Settings.SessionContext.CurrentData = null;
            string filePath = Convert.ToString(Session["filePath"]);
            WebClient client = new WebClient();
            Byte[] buffer = client.DownloadData(filePath);
            if (buffer != null)
            {
                Response.Clear();
                Response.ClearContent();
                Response.ClearHeaders();
                Response.ContentType = "application/pdf";
                Response.AddHeader("content-length", buffer.Length.ToString());
                Response.BinaryWrite(buffer);
                Response.Flush();
                Response.End();
            }
            logger.debug("Ending in Display.Page_Load()");

        }
    }
}